<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Title</title>
		<style>
			.content {
				width: 400px;
				height: 400px;
				background: green;
				position: relative;
			}

			.box {
				width: 100px;
				height: 100px;
				background: red;
				position: absolute;
				left: 200px;
				top: 200px;
			}
		</style>
		<script>
			window.onload = function() {
				var content = document.getElementsByClassName('content')[0];
				var show = document.getElementsByClassName('show')[0]
				content.onmousemove = function(event) {

					var evt = event || window.event;

					//offsetY 在低版本的火狐中不能用
					// show.innerHTML = evt.offsetX + ',' + evt.offsetY;

					show.innerHTML = event.pageX-content.offsetLeft+','+
					        (event.pageY-content.offsetTop);

				}



			}
		</script>
	</head>
	<body>

		<div class="content">

			<div class="box">

			</div>


		</div>

		<div class="show"></div>


	</body>
</html>
